﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Alerts.aspx.cs" Inherits="bba.framework.infraweb.masterpage.Pages.Alerts" EnableTheming="false" Theme=""  %>

<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Alertas</title>
    
    <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/App_Themes/InfraWebTheme/Alertas.css")%>"></link>
    <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/App_Themes/InfraWebTheme/Datepicker/themes/root/ui.all.css")%>"></link>
    <script language="javascript" type="text/javascript" src="<%= ResolveUrl("~/Scripts/menu.js") %>"></script>
    <script language="javascript" type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.3.2.min.js") %>"></script>
    <script language="javascript" type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.3.2.min-vsdoc.js") %>"></script>
    <script language="javascript" type="text/javascript" src="<%= ResolveUrl("~/Scripts/Datepicker/ui/ui.core.js") %>"></script>
    <script language="javascript" type="text/javascript" src="<%= ResolveUrl("~/Scripts/Datepicker/ui/ui.datepicker.js") %>"></script>
    <script language="javascript" type="text/javascript" src="<%= ResolveUrl("~/Scripts/Datepicker/ui/ui.datepicker-pt-BR.js") %>"></script>
    <script language="javascript" type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.maskedinput-1.2.2.js")%>"></script>
    <script type="text/javascript">
    jQuery(function($){
        $("#horarioTxt").mask("99:99");});
    $(document).ready(function() {
        eventosAlertsWindow();
         $("input.#scheduleTxt").datepicker($.datepicker.regional["pt-BR"]);
    });
    
    </script>
    <base target=_self> 
    <style type="text/css">
        #scheduleTxt
        {
            width: 106px;
        }
        #horarioTxt
        {
            width: 60px;
        }
    </style>
</head>
<body>
    <form id="Alerts" runat="server">
    <div id="todo" class="todo">
    <div class="cabecalho">
		<p>Serviço de alertas <img src="../App_Themes/InfraWebTheme/images/alert.png" /></p>
	</div>
	<div id="Cadastro" class="Cadastro">
	
	<div class="tabela">
        <table id="tb_Main" class="tbMain" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <asp:Label ID="titulo" runat="server" Text="Título:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtTitulo" runat="server" Width="392px" MaxLength="99"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="subTitulo" runat="server" Text="Subtítulo:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSubTitulo" runat="server" Width="391px" MaxLength="99"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="descricao" runat="server" Text="Descrição:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtDescricao" runat="server" TextMode="MultiLine" 
                     Width="393px" MaxLength="500"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="descriptionRegularExpression" 
                        runat="server" ControlToValidate="txtDescricao" 
                        ErrorMessage="A Descrição deve conter de 1 a 500 caracteres" 
                        ValidationExpression="^[\w\W]{0,500}$" Display="Dynamic"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="link" runat="server" Text="Link: "></asp:Label>
                </td>
                <td>
                    <asp:TextBox  ID="txtLink" runat="server" Width="390px" Height="22px" 
                        MaxLength="254"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="urlRegularExpression" runat="server" 
                        ControlToValidate="txtLink" ErrorMessage="Url inválida." 
                        ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?" 
                        Display="Dynamic"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td>
                
                    <asp:Label CssClass="destinatario" ID="grupo" runat="server" Text="Destinatários: "></asp:Label>
                </td>
                <td>
                <div class="destination">
                        <div>
                            <asp:CheckBox CssClass="checkMarcado" ID="ckbGroup" runat="server" 
                                Text="Grupos de usuários" AutoPostBack="True" 
                                oncheckedchanged="ckbGroup_CheckedChanged" />
                            <br />
                            <asp:CheckBox ID="ckbGroupTodos" runat="server" 
                                Text="Todos" AutoPostBack="True" 
                                oncheckedchanged="ckbGroupTodos_CheckedChanged" />
                        </div>
                        <div class="systems" runat=server id="divSystems">
                        
                        <asp:CheckBoxList ID="ckbSystemList" runat="server" CellPadding="0" 
                            CellSpacing="0" 
                            onselectedindexchanged="ckbSystemList_SelectedIndexChanged" RepeatColumns="2">
                        </asp:CheckBoxList>
                    </div>
                    <br />
                    <div class="users">
                    <asp:CheckBox CssClass="checkMarcado" ID="ckbUsers" runat="server" 
                            Text="Selecionar usuários" oncheckedchanged="ckbUsers_CheckedChanged" 
                            AutoPostBack="True" /><br />
                    <asp:TextBox ID="txtUserName" runat="server" 
                            TextMode="MultiLine" Width="180px" MaxLength="99"></asp:TextBox>
                    </div>
                   </div>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Label ID="lblMessage" runat="server" ForeColor="#CC3300" Height="30px" 
                        Text="Label" Visible="False"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblSchedule" runat="server" Text="Notificar em: "></asp:Label>
                </td>
                <td align="left" valign="middle">
                <input id="scheduleTxt" runat="server" type="text" readonly="readonly" />&nbsp;<input id="horarioTxt" runat="server" type="text" />
                    </td>
            </tr>
            <tr>
                <td></td>
                <td align="center">
                <asp:Label runat="server" ID="hiddenIdAlert" Visible="False"></asp:Label>
                    <asp:ImageButton ImageUrl="~/App_Themes/InfraWebTheme/images/adicionar.png"
                        ID="adicionarImgButton" runat="server" onclick="adicionarImgButton_Click" />
                    <asp:ImageButton Visible="false" ImageUrl="~/App_Themes/InfraWebTheme/images/atualizar.png" 
                        id="updateButton"  runat="server" onclick="updateButton_Click" />
                    <asp:ImageButton ImageUrl="~/App_Themes/InfraWebTheme/images/cancelar.png" 
                        ID="cancelarImgButton" runat="server" OnClientClick="closeWindow()" 
                        onclick="cancelarImgButton_Click" />
                    <asp:ImageButton Visible="false" ImageUrl="~/App_Themes/InfraWebTheme/images/novoAlerta.png" 
                        id="newButton" runat="server" onclick="newButton_Click" />
                    
                </td>
            </tr>
	    </table>
	    <br />
	 <div>
	<asp:Label ID="gridTitulo" runat="server" Text="Alertas Cadastrados "></asp:Label>
	 	 <asp:GridView ID="alertDataGridView" runat="server" Width="475px" 
             AutoGenerateColumns="False" HeaderStyle-Width="50" AllowPaging="True" 
             DataKeyNames="Id" EmptyDataText="Não existe nenhum alerta cadastrado" 
             onpageindexchanging="alertDataGridView_PageIndexChanging" 
             onrowdeleting="alertDataGridView_RowDeleting" CellPadding="3" 
             OnRowEditing="alertDataGridView_RowEditing">
             	 <HeaderStyle CssClass="odd" Width="50px"/>
             	 <Columns>
                     <asp:TemplateField AccessibleHeaderText="Alerta" HeaderText="Alerta" HeaderStyle-Width="50">
                    <ItemTemplate>
                        <asp:Label ID="TitleRow" runat="server" Text='<%# Eval("Title") %>' />
                    </ItemTemplate>
<HeaderStyle Width="50px"></HeaderStyle>
                    </asp:TemplateField>
                     <asp:TemplateField AccessibleHeaderText="Id" HeaderText="Id" HeaderStyle-Width="50">
                    <ItemTemplate>
                        <asp:Label ID="IdRow" runat="server" Text='<%# Eval("ID") %>' />
                    </ItemTemplate>

<HeaderStyle Width="50px"></HeaderStyle>
                    </asp:TemplateField>
                     <asp:TemplateField AccessibleHeaderText="SubTitle" HeaderText="Assunto" HeaderStyle-Width="50">
                    <ItemTemplate>
                        <asp:Label ID="SubTitleRow" runat="server" Text='<%# Eval("SubTitle") %>' />
                    </ItemTemplate>
                    
<HeaderStyle Width="50px"></HeaderStyle>
                    </asp:TemplateField>
                     <asp:TemplateField AccessibleHeaderText="Descrição" HeaderText="Descrição" HeaderStyle-Width="50">
                    <ItemTemplate>
                        <asp:Label ID="DescriptionRow" runat="server" Text='<%# Eval("Description") %>' />
                    </ItemTemplate>
<HeaderStyle Width="50px"></HeaderStyle>
                    </asp:TemplateField>
                     <asp:TemplateField  AccessibleHeaderText="Ativação" HeaderText="Ativação" 
                         HeaderStyle-Width="50">
                    <ItemTemplate>
                        <asp:Label ID="ScheduleRow" runat="server" Text='<%# Eval("Schedule") %>' />
                    </ItemTemplate>
                    
                    
<HeaderStyle Width="50px"></HeaderStyle>
                    </asp:TemplateField>
             	     <asp:TemplateField ShowHeader="False">
                         <ItemTemplate>
                             <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                 CommandName="Delete" Text="Excluir"></asp:LinkButton>
                         </ItemTemplate>
                     </asp:TemplateField>
             	     <asp:CommandField ShowEditButton="True"  />
             	 </Columns>
        </asp:GridView>
        
     </div>
    </div>
    </form>
    
</body>
</html>
